<?php

/*
* @author ducnhat
* @email ddnhat@gmail.com
* @copyright 2014
*/

class Zenddn_View_Helper_Taxonomy extends Zend_View_Helper_Abstract{
    
    public function taxonomy($type){
        $cache = new Zenddn_System_Cache();
        $cache = $cache->getCache();  
        $type_replace = str_ireplace(" ", "_", $type);
        $cache_id = "taxonomy_{$type_replace}";
        
        if(($taxonomy = $cache->load($cache_id)) === false){
            $model = new Default_Model_Taxonomy();
            $taxonomy = $model->getAllData($type);
            
            $cache->save($taxonomy, $cache_id, array('taxonomy'));
        }
        
        return $taxonomy;
    }
}